package com.lb.uts.service;

import com.github.pagehelper.PageInfo;
import com.lb.uts.entity.ScheduleJob;
import com.lb.uts.mapper.JobExecuteRecordMapper;
import com.lb.uts.entity.JobExecuteRecord;
import com.lb.uts.entity.JobSearch;

/**
 * @author liangb
 * @date 2019/4/26 17:22
 */
public interface IJobRecordService extends IBaseService<JobExecuteRecordMapper, JobExecuteRecord> {
    /**
     * 插入调用记录数据
     *
     * @param job
     * @param executeResult 执行结果描述信息
     * @return
     */
    JobExecuteRecord insertJobExecuteRecord(ScheduleJob job, String executeResult, String host);


    /**
     * 统计数量
     *
     * @param jobId
     * @param status
     * @return
     */
    int countJobRecordNum(String jobId, String status);


    /**
     * 通过{@link JobSearch} 查询
     *
     * @param pageNo
     * @param pageSize
     * @param status
     * @param jobSearch
     * @return
     */
    PageInfo<JobExecuteRecord> queryList(int pageNo, int pageSize, String status, JobSearch jobSearch);

    void updateFailRecord(String systemName, String host, String jobRecordId, String e);

    /**
     * 更新执行记录为成功
     */
    void updateSuccessRecord(String systemName, String status, String host, String jobRecordId, String result);

}
